package com.ctyon.watchmanager.model.net.service;

import com.ctyon.netlibrary.net.revert.BaseResponseEntity;
import com.ctyon.netlibrary.net.revert.BaseResponseEntity2;
import com.ctyon.netlibrary.use.RetrofitFactory;
import com.ctyon.watchmanager.model.net.api.Api;
import com.ctyon.watchmanager.model.net.entity.SmsNotification;

import io.reactivex.Observable;

/**
 * @describe
 */
public class NetService {

    private Api api;
    private RetrofitFactory retrofitFactory;

    private NetService() {
        retrofitFactory = RetrofitFactory.getInstance();
        api = retrofitFactory.create(Api.class);
    }

    public static NetService getInstance() {
        return Service1Holder.S_INSTANCE;
    }

    public boolean isDisable(String method) {
        return retrofitFactory.isExist(method);
    }

    public NetService method(String method) {
        RetrofitFactory.getInstance().addMethod(method);
        return getInstance();
    }

    private static class Service1Holder {
        private static final NetService S_INSTANCE = new NetService();
    }

    public Observable<BaseResponseEntity> getCode(String phoneNumber) {
        return api.getCode(phoneNumber);
    }

    public Observable<BaseResponseEntity> findPasswordGetCode(String phoneNumber) {
        return api.findPasswordGetCode(phoneNumber);
    }

    public Observable<BaseResponseEntity> register(String phoneNumber, String password, String code) {
        return api.register(phoneNumber, password, code);
    }

    public Observable<BaseResponseEntity> findPassword(String phoneNumber, String password, String code) {
        return api.findPassword(phoneNumber, password, code);
    }

    public Observable<BaseResponseEntity> login(String phoneNumber, String password) {
        return api.login(phoneNumber, password);
    }

    public Observable<BaseResponseEntity> addWatch(Long managerId, String watchId, String nick) {
        return api.addWatch(managerId, watchId, nick);
    }

    public Observable<BaseResponseEntity> removeWatch(Long managerId, String watchId) {
        return api.removeWatch(managerId, watchId);
    }

    public Observable<BaseResponseEntity> getWatchList(Long managerId) {
        return api.getWatchList(managerId);
    }

    public Observable<BaseResponseEntity> setInterval(Long managerId, String watchId, Long interval) {
        return api.setInterval(managerId, watchId, interval);
    }

    public Observable<BaseResponseEntity> voiceProtect(Long managerId, String watchId, String phoneNumber) {
        return api.voiceProtect(managerId, watchId, phoneNumber);
    }

    public Observable<BaseResponseEntity> sosNumber(Long managerId, String watchId, String sos1, String sos2, String sos3) {
        return api.sosNumber(managerId, watchId, sos1, sos2, sos3);
    }

    public Observable<BaseResponseEntity> smsNotification(String content) {
        return api.smsNotification(content);
    }

    public Observable<SmsNotification> getSmsNotification(String manager_id, String watch_id) {
        return api.getSmsNotification(manager_id, watch_id);
    }

    public Observable<BaseResponseEntity> sosConfig(Long managerId, String watchId, boolean config) {
        return api.sosConfig(managerId, watchId, config);
    }

    public Observable<BaseResponseEntity> lowBatConfig(Long managerId, String watchId, boolean config) {
        return api.lowBatConfig(managerId, watchId, config);
    }

    public Observable<BaseResponseEntity> locationNow(Long managerId, String watchId) {
        return api.locationNow(managerId, watchId);
    }

    public Observable<BaseResponseEntity> getAllLocation(Long managerId, String watchId, Long time) {
        return api.getAllLocation(managerId, watchId, time);
    }

    public Observable<BaseResponseEntity> powerOff(Long managerId, String watchId) {
        return api.powerOff(managerId, watchId);
    }

    public Observable<BaseResponseEntity> reboot(Long managerId, String watchId) {
        return api.reboot(managerId, watchId);
    }

    public Observable<BaseResponseEntity> noDisturb(Long managerId, String watchId, String intervals) {
        return api.noDisturb(managerId, watchId, intervals);
    }

    public Observable<BaseResponseEntity> findWatch(Long managerId, String watchId) {
        return api.findWatch(managerId, watchId);
    }

    public Observable<BaseResponseEntity> alarm(Long managerId, String watchId, String alarms) {
        return api.alarm(managerId, watchId, alarms);
    }

    public Observable<BaseResponseEntity> contacts(Long managerId, String watchId, String contacts) {
        return api.contacts(managerId, watchId, contacts);
    }

    public Observable<BaseResponseEntity> takePicture(Long managerId, String watchId) {
        return api.takePicture(managerId, watchId);
    }

    public Observable<BaseResponseEntity> checkMoney(Long managerId, String watchId) {
        return api.checkMoney(managerId, watchId);
    }

    public Observable<BaseResponseEntity> checkData(Long managerId, String watchId) {
        return api.checkData(managerId, watchId);
    }

    public Observable<BaseResponseEntity> flower(Long managerId, String watchId, Integer counts) {
        return api.flower(managerId, watchId, counts);
    }

    public Observable<BaseResponseEntity> notify(Long managerId, String watchId, String text) {
        return api.notify(managerId, watchId, text);
    }

    public Observable<BaseResponseEntity> phoneCall(Long managerId, String watchId, String phoneNumber) {
        return api.phoneCall(managerId, watchId, phoneNumber);
    }

    public Observable<BaseResponseEntity> stepConfig(Long managerId, String watchId, boolean config) {
        return api.stepConfig(managerId, watchId, config);
    }

    public Observable<BaseResponseEntity> stepIntervals(Long managerId, String watchId, String intervals) {
        return api.stepIntervals(managerId, watchId, intervals);
    }

    public Observable<BaseResponseEntity> scene(Long managerId, String watchId, Integer model) {
        return api.scene(managerId, watchId, model);
    }

    public Observable<BaseResponseEntity> language(Long managerId, String watchId, Integer language, Integer timezone) {
        return api.language(managerId, watchId, language, timezone);
    }

    public Observable<BaseResponseEntity> checkUpdate(Long managerId, String version) {
        return api.checkUpdate(managerId, version);
    }

    public Observable<BaseResponseEntity> updateNick(Long managerId, String nick) {
        return api.updateNick(managerId, nick);
    }

    public Observable<BaseResponseEntity> loadChatMessage(String watchId , Long time ) {
        return api.getChatRecord(watchId, time);
    }

    public Observable<BaseResponseEntity> updatePassword(Long managerId, String oldPassword, String newPassWord) {
        return api.updatePassWord(managerId, oldPassword, newPassWord);
    }

    public Observable<BaseResponseEntity> getImg(String watchId) {
        return api.getImg(watchId);
    }

    public Observable<BaseResponseEntity> delImg(String watchId, String sendTime) {
        return api.delImg(watchId, sendTime);
    }

    public Observable<BaseResponseEntity> uploadConfig(Long managerId, String watchId, String config) {
        return api.uploadConfig(managerId, watchId, config);
    }

    public Observable<BaseResponseEntity> program(Long managerId, String watchId, String program) {
        return api.program(managerId, watchId, program);
    }

    public Observable<BaseResponseEntity> video(Long managerId, String watchId, String videoId) {
        return api.video(managerId, watchId, videoId);
    }


}
